using Provausio.Common.Objects;
using TrainingManagement.api.Models.BusinessObjects.Responses;
using TrainingManagement.api.Models.Data.CRUD;
using TrainingManagement.api.Models.Data.CRUD.Employee;

namespace TrainingManagement.api.Models.BusinessLogic.Employee
{
    public class EmployeeDeactivateOperation : BusinessOperation<int, GeneralResponse>
    {
        readonly EmployeeDeactivateDataSource _employeeDeactivate = new EmployeeDeactivateDataSource();
        public override GeneralResponse Run(int input)
        {
            var resp = new GeneralResponse();
            if (_employeeDeactivate.Execute(input))
            {
                resp.Message = string.Format("Employee {0} was Deactivated.", input);
                resp.StatusCode = 200;
                return resp;
            }

            resp.Message = string.Format("Employee {0} failed to deactivate.", input);
            resp.StatusCode = 500;
            return resp;
        }
    }
}